package hacker_rank._101hackfeb;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;

public class ColoringTree {
	private static int N;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");

		N = Integer.parseInt(line[0]);
		int M = Integer.parseInt(line[1]);
		Node root = NodeFactory.getNode(Integer.parseInt(line[2]));

		for (int i = 0; i < N - 1; i++) {
			line = br.readLine().split(" ");
			Node A = new Node(Integer.parseInt(line[0]));
			Node B = new Node(Integer.parseInt(line[1]));
			A.addChild(B);
		}
		
		for(int i = 1; i <=N; i++) {
			doBfs(root, i, Integer.parseInt(br.readLine()));
			
		}
		for(int i = 0; i < M;i++) {
			int nid  = Integer.parseInt(br.readLine());
			System.out.println(NodeFactory.getNode(nid).value.cardinality());
		}

	}
	


	private static void doBfs(Node root, int node_id, int value) {
		Queue<Node> q = new LinkedList<Node>();
		
		
		Set<Integer> visited = new HashSet<Integer>();
		q.add(root);
		visited.add(root.id);
		
		while(!q.isEmpty()) {
			Node t = q.remove();
			visited.add(t.id);
			if(t.id == node_id) {
				t.value.set(value);
				break;
			}
			t.value.set(value);
			for(Node ch : t.children)
				if(visited.contains(ch.id) ==false)
					q.add(ch);
		}
	}



	static class NodeFactory {
		static Node[] createdNodes = new Node[N + 1];
		static {
			Arrays.fill(createdNodes, null);
		}

		public static Node getNode(int id) {
			if (createdNodes[id] == null)
				createdNodes[id] = new Node(id);
			return createdNodes[id];
		}
	}

	static class Node {
		int id;
		List<Node> children;
		BitSet value = new BitSet();
		
		@Override
		public boolean equals(Object obj)
		{
			Node t  = (Node) obj;
			return (t.id == this.id);
		}

		public Node(int id) {
			this.id = id;
			this.children = new ArrayList<Node>();

		}
		public void addChild(Node child) {
			this.children.add(child);
			
		}
		

	}

}
